import { IDispose } from "../../../../../com/gengine/core/IDispose";
import { SChatMsg } from "../../../../../Message/Game/SChatMsg";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { ChatItemData } from "../chatViewData/ChatItemData";
import { ChatItem } from "./ChatItem";
import { ChatAnalysisType } from "../chatViewData/ChatAnalysisType";
import { ChatMessageWorking } from "../chatViewData/ChatMessageWorking";
import { PlayerMiniInfo } from "../../../model/PlayerMiniInfo";
import { FaceAuthority } from "../data/FaceAuthority";
type int = number;
//class TextRecord
    
    export  class TextRecord /* flash.display.Sprite */ implements IDispose
    {
        

        public get chatMsg(): SChatMsg
        {
            return this._chatMsg;
        }

        public set chatMsg(arg1: SChatMsg)
        {
            this._chatMsg = arg1;
            return;
        }

        public get isFilter(): Boolean
        {
            return this._isFilter;
        }

        public set isFilter(arg1: Boolean)
        {
            this._isFilter = arg1;
            return;
        }

        public get isShowTitle(): Boolean
        {
            return this._isShowTitle;
        }

        public set isShowTitle(arg1: Boolean)
        {
            this._isShowTitle = arg1;
            return;
        }

        public get lineHeight(): number
        {
            return this._lineHeight;
        }

        public set lineHeight(arg1: number)
        {
            this._lineHeight = arg1;
            return;
        }

        public get lineWidth(): number
        {
            return this._lineWidth;
        }

        public set lineWidth(arg1: number)
        {
            this._lineWidth = arg1;
            return;
        }

        public /* override */ get height(): number
        {
            if (this._chatItem) 
            {
                return this._chatItem.height;
            }
            return 0;
        }

        public dispose(arg1: Boolean=true): void
        {
            this._lineHeight = 260;
            this._lineWidth = 21;
            this._content = null;
            this._chatMsg = null;
            this._analysisType = 1;
            this._defaultColor = 16777215;
            this._aryPlayer = null;
            this._isFilter = true;
            this._isShowTitle = false;
            ObjectPool.disposeObject(this);
            return;
        }

        public get faceAuthortiy(): int
        {
            return this._faceAuthortiy;
        }

        public set faceAuthortiy(arg1: int)
        {
            this._faceAuthortiy = arg1;
            return;
        }

        public init(arg1: number=260, arg2: number=21): void
        {
            this._lineWidth = arg1;
            this._lineHeight = arg2;
            return;
        }

        public draw(): void
        {
            if (!this._chatItem) 
            {
                this._chatItemData = ObjectPool.getObject(ChatItemData);
                this._chatItem = new ChatItem();
                this.addChild(this._chatItem);
            }
            this._chatItem.lineWidth = this._lineWidth;
            this._chatItem.lineHeight = this._lineHeight;
            var loc1=this._analysisType;
            switch (loc1) 
            {
                case ChatAnalysisType.AnalysisTypeFace:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDataByContent(this._content, this._defaultColor, false, 12, this._faceAuthortiy);
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeChat:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDataByPlayerInfo(new PlayerMiniInfo(this._chatMsg.fromPlayer));
                    this._chatItemData.cellVector = this._chatItemData.cellVector.concat(ChatMessageWorking.getCellDatas(this._chatMsg.content, this._chatMsg.playerItems, this._chatMsg.petInfos, -1, 12, FaceAuthority.getMiniPlayerAuthority(this._chatMsg.fromPlayer)));
                    this._chatItem.groupVector = this._chatItemData.getAllElements();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeHtml:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDatasFilterHtml(this._content);
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeRumor:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDatasByAnalyzeRumor(this._content, this._aryPlayer ? this._aryPlayer : new Array<any>());
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
            }
            this._chatItemData.dispose();
            return;
        }

        public get content(): string
        {
            return this._content;
        }

        public set content(arg1: string)
        {
            this._content = arg1;
            return;
        }

        public get analysisType(): int
        {
            return this._analysisType;
        }

        public set analysisType(arg1: int)
        {
            this._analysisType = arg1;
            return;
        }

        public get defaultColor(): int
        {
            return this._defaultColor;
        }

        public set defaultColor(arg1: int)
        {
            this._defaultColor = arg1;
            return;
        }

        public get aryPlayer(): Array<any>
        {
            return this._aryPlayer;
        }

        public set aryPlayer(arg1: Array<any>)
        {
            this._aryPlayer = arg1;
            return;
        }

        /* internal */ /* var */_lineHeight: number;

        /* internal */ /* var */_lineWidth: number;

        /* internal */ /* var */_content: string;

        /* internal */ /* var */_chatMsg: SChatMsg;

        /* internal */ /* var */_analysisType: int=1;

        /* internal */ /* var */_defaultColor: int=16777215;

        /* internal */ /* var */_aryPlayer: Array<any>;

        /* internal */ /* var */_isFilter: Boolean=true;

        /* internal */ /* var */_isShowTitle: Boolean=false;

        /* internal */ /* var */_faceAuthortiy: int=1;

        /* internal */ /* var */_chatItem: ChatItem;

        /* internal */ /* var */_chatItemData: ChatItemData;
    }
